package com.bosc.modeling.service;

import com.bosc.modeling.dao.gen.EnrollEntityMapper;
import com.bosc.modeling.dao.gen.TeamEntityMapper;
import com.bosc.modeling.pojo.gen.EnrollEntity;
import com.bosc.modeling.pojo.gen.EnrollEntityExample;
import com.bosc.modeling.pojo.gen.TeamEntity;
import com.bosc.modeling.pojo.gen.TeamEntityExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yuanyj
 * @version 1.0
 * @date 2019/11/22 10:45
 * @description
 */
@Service
public class TeamService {
    @Autowired
    EnrollEntityMapper enrollEntityMapper;
    @Autowired
    TeamEntityMapper teamEntityMapper;
    public List<EnrollEntity> getEnrollByCompetitionId(String competitionId){
        EnrollEntityExample example = new EnrollEntityExample();
        example.createCriteria().andCompetitionIdEqualTo(competitionId);
        return enrollEntityMapper.selectByExample(example);
    }
    public List<TeamEntity> getTeamByUserId(String teamId, String userId){
        TeamEntityExample example = new TeamEntityExample();
        example.createCriteria().andTeamIdEqualTo(teamId).andUserIdEqualTo(userId);
        return teamEntityMapper.selectByExample(example);
    }
    public List<TeamEntity> getTeamByTeamId(String teamId){
        TeamEntityExample example = new TeamEntityExample();
        example.createCriteria().andTeamIdEqualTo(teamId);
        return teamEntityMapper.selectByExample(example);
    }
}
